<template>
    <div class="g-recomment">
        <h2>热点推荐</h2>
        <ul>
            <router-link
                tag="li"
                class="recomment-item border-bottom"
                v-for="item of list"
                :key="item.id"
                v-if="showRecomment"
                :to="'/detail/'+ item.id"
            >
                <img class="item-img" :src="item.imgUrl" alt="" />
                <div class="item-info ">
                    <p class="item-title">{{item.title}}</p>
                    <p class="item-desc">{{item.desc}}</p>
                    <button class="item-button">查看详情</button>
                </div>
            </router-link>
        </ul>
    </div>
</template>

<script>
export default {
  name: 'HomeRecomment',
  props: {
    list: Array
  },
  computed: {
    showRecomment () {
      return this.list.length
    }
  }
}
</script>

<style lang="stylus" scoped>
    @import '~styles/mixins.styl'
    .g-recomment
        h2
            line-height .8rem
            background #eee
            text-indent .2rem
    .recomment-item
        display flex
        padding .2rem 0
        margin-left .2rem
        // background #f7f7f7
        .item-img
            width 2rem
            height 2rem
            margin-right .2rem
        .item-info
            flex 1
            min-width 0
            .item-title
                ellipsis()
                font-size .36rem
                line-height .6rem
            .item-desc
                ellipsis()
                line-height .4rem
            .item-button
                margin-top .5rem
                padding 0 .2rem
                border-radius .06rem
                color #fff
</style>
